import request from '@/utils/request'
import { defineStore } from 'pinia'
import { showDialog } from 'vant'
import deserveApi, { type navWapData, type recAuto, type video } from '@/api/deserve'

interface deserveData {
  navWap: navWapData[]
  recAuto: recAuto[]
}
export const useDeserveStore = defineStore('deserve', {
  state(): deserveData {
    return {
      navWap: [],
      recAuto: [
        {
          look: {
            appBanHeight: 0,
            appBanWidth: 0,
            avatar: '',
            content: '',
            lookPics: [],
            nickmame: '',
            picUrl: '',
            readCount: 0,
            schemeUrl: '',
            title: '',
            topicId: ''
          },
          topics: []
        }
      ]
    }
  },
  actions: {
    async getNavWap() {
      try {
        const res = await deserveApi.getNavWap()
        this.navWap = res.data.navList
      } catch (error) {}
    },
    async getRecAuto(page: number) {
      try {
        const res = await deserveApi.getRecAuto(page)
        this.recAuto = res.data.result
      } catch (error) {}
    }
  },
  getters: {}
})
